package com.headwind.logistics.prople.service.impl;


import com.headwind.logistics.common.pojo.Address;
import com.headwind.logistics.prople.dto.CustomerAddressDTO;
import com.headwind.logistics.prople.mapper.CustomerAddressMapper;
import com.headwind.logistics.prople.service.inter.CustomerAddressServiceInter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author Gu1028
 * @Date 2020/7/25 10:12
 * @Version 1.0
 * @DESCRIPTION 填写类作用描述
 */
@Service
public class CustomerAddressServiceImpl implements CustomerAddressServiceInter {

    @Resource
    private CustomerAddressMapper customerAddressMapper;

    /**
     * 查询出所有数据并且分页
     * @param page
     * @param rows
     * @return
     */

    @Override
    public List<CustomerAddressDTO> selectAllCustomerAddress(Integer page, Integer rows) {
        if (page != null){
            page = (page-1)*rows;
        }
        return customerAddressMapper.selectAllCustomerAddress(page,rows);
    }

    /**
     * 根据姓名、手机号 搜索地址
     * @param customerAddressDTO
     */

    @Override
    public List<CustomerAddressDTO> queryCustomerAddressByNameOrPhone(CustomerAddressDTO customerAddressDTO, Integer page, Integer rows) {
        if (page != null){
            page = (page-1)*rows;
        }

        return customerAddressMapper.queryCustomerAddressByNameOrPhone(customerAddressDTO,page,rows);
    }

    @Override
    public List<CustomerAddressDTO> selectAllCustomerAddressByUserId(Integer page, Integer rows, String userId) {
        return customerAddressMapper.selectAllCustomerAddressByUserId(page,rows,userId);
    }
}
